
from fastapi import FastAPI,Body
app.post("/coze")
async def coze_post(
    query:str = Body(default=...,description="用户输出",embed=True)
):
    list = query.split(",")
    role = list[0]
    theme = list[1]
'''
This example describes how to use the workflow interface to chat.
'''
import os
# Our official coze sdk for Python [cozepy](https://github.com/coze-dev/coze-py)
from cozepy import COZE_CN_BASE_URL
# Get an access token through personal access token or oauth.
coze_api_token = ''
# The default access is api.coze.com, but if you need to access api.coze.cn,
# please use base url to configure the api endpoint to access
coze_api_base = COZE_CN_BASE_URL
from cozepy import Coze, TokenAuth, Message, ChatStatus, MessageContentType # noqa
# Init the Coze client through the access token.
coze = Coze(auth=TokenAuth(token=coze_api_token), base_url=coze_api_base)
# Create a workflow instance in Coze, copy the last number from the web link as the workflow's ID.
workflow_id = '7562375961132679209'
# Call the coze.workflows.runs.create method to create a workflow run. The create method
# is a non-streaming chat and will return a WorkflowRunResult class.
workflow = coze.workflows.runs.create(
    workflow_id=workflow_id,
    parameters={
        'role':role,
        'theme':theme
    }
)
print("workflow_data", workflow.data)